
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <limits>

using ll  = long long;

const ll max_n = 500+5;
ll n, arr[max_n], pre[max_n];

struct Sec{
    ll start,end,sum;
    bool is_have(const ll &n)const noexcept{
        return start<=n && n<=end;
    }
}secs[max_n*max_n];
ll secs_size{1};

const ll buf_size {1024*1024*1024};
char buf[buf_size];

int main(){
    std::cin.rdbuf()->pubsetbuf(buf, buf_size);
    std::cin>>n;
    for(ll i{1};i<=n;i++){
        std::cin>>arr[i];
        pre[i]=pre[i-1]+arr[i];
    }
    for(ll i{1};i<=n;i++){
        for(ll j{i};j<=n;j++){
            secs[secs_size++] = {i,j,pre[j]-pre[i-1]};
        }
    }
    std::sort(secs+1,secs+secs_size,[](const Sec &a,const Sec &b)->bool{
        return a.sum<b.sum;
    });
    for(ll i{1};i<=n;i++){
        ll min{std::numeric_limits<ll>::max()};
        for(ll j{2};j<=secs_size;j++){
            if(secs[j-1].is_have(i) != secs[j].is_have(i)){
                min = std::min(min,std::abs(secs[j].sum-secs[j-1].sum));
            }
        }
        std::cout<<min<<'\n';
    }
}